package models;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import play.db.jpa.Model;

@Entity
public class CommonTable extends Model{
    public final static String EMPTY_TABLE_NAME = "";

    public CommonTable() {
        
    }
    
    public CommonTable(Long tableId) {
        this.id = tableId;
    }
    
    public String name;
    
    @ManyToOne(optional=false)
    @JoinColumn(nullable = false, name = "maintainerid", referencedColumnName = "id")
    public User maintainer;
    
    public Date createDate;
    
    public boolean isActive = true;
    
    public static List<CommonTable> findActiveTable() {
        return CommonTable.find("isActive", true).fetch();
    }
}
